<template>
	<view v-if="userInfo !== null">
		<view style="border-bottom: 1rpx solid #C0C0C0;padding-top: 20rpx;padding-bottom: 20rpx;">
			<view>
				<view style="display: flex;justify-content: space-evenly;">
					<view style="width: 20%;"><img style="max-width:100%;" :src="userInfo.userAvatar" alt="">
					</view>
					<view style="width: 70%;">
						<view style="font-size: larger;">申请人：{{userInfo.userUsername}}
							<img v-if="userInfo.userSex==1" style="width: 40rpx;margin-left: 10rpx;"
								src="../../static/tabbar/male.png" alt="">
							<img v-if="userInfo.userSex==0" style="width: 40rpx;margin-left: 10rpx;"
								src="../../static/tabbar/female.png" alt="">
						</view>
						<view style="font-size: medium;color: #808080;margin-top: 4%;">
							手机号：{{userInfo.userPhone}}
						</view>
					</view>
				</view>
				<view style="text-align: center;font-size: smaller;color: #808080;">
					QQ：{{userInfo.userQq!==null?userInfo.userQq:'无'}} |
					微信：{{userInfo.userVx!==null?userInfo.userVx:'无'}}</view>
			</view>
		</view>
		<uni-list>
			<uni-list-item title="个人资料" :show-extra-icon="true"
				:extraIcon="{color: '#bfbfbf',size: '22',type: 'person'}" link="navigateTo" to="./myInfo" />
			<uni-list-item title="账号管理" :show-extra-icon="true"
				:extraIcon="{color: '#bfbfbf',size: '22',type: 'locked'}" link="navigateTo" to="./accountManage" />
			<uni-list-item title="我的社团" :show-extra-icon="true" :extraIcon="{color: '#bfbfbf',size: '22',type: 'home'}"
				link="navigateTo" to="./myOrganization" />
			<uni-list-item title="我的申请记录" :show-extra-icon="true"
				:extraIcon="{color: '#bfbfbf',size: '22',type: 'bars'}" link="navigateTo" to="./myApplication" />
			<uni-list-item title="申请创建社团" :show-extra-icon="true"
				:extraIcon="{color: '#bfbfbf',size: '22',type: 'plus'}" link="navigateTo"
				to="./organization/applyOrganization" />
			<uni-list-item v-if="userInfo.identity" title="审批社团创建/注销" :show-extra-icon="true"
				:extraIcon="{color: '#bfbfbf',size: '22',type: 'loop'}" link="navigateTo"
				to="./organization/judgeOrgList" />
			<uni-list-item v-if="userInfo.identity" title="社团星级评定" :show-extra-icon="true"
				:extraIcon="{color: '#bfbfbf',size: '22',type: 'star'}" link="navigateTo"
				to="./organization/starOrganization" />
			<uni-list-item v-if="userInfo.identity" title="已注销社团" :show-extra-icon="true"
				:extraIcon="{color: '#bfbfbf',size: '22',type: 'trash'}" link="navigateTo"
				to="./organization/cancelledOrganization" />
			<uni-list-item v-if="userInfo.identity" title="社联管理团列表" :show-extra-icon="true"
				:extraIcon="{color: '#bfbfbf',size: '22',type: 'paperplane'}" link="navigateTo" to="./manager/Manage" />
			<uni-list-item title="退出登录" :show-extra-icon="true"
				:extraIcon="{color: '#bfbfbf',size: '22',type: 'closeempty'}" @click="exitLogin" clickable />
		</uni-list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: null
			}
		},
		onShow() {
			// 检查消息
			this.check.checkMessage(this)
			// 获取用户信息
			this.getUserInfo()
		},
		// 监听下拉刷新动作
		onPullDownRefresh() {
			this.getUserInfo()
			// 结束下拉刷新
			setTimeout(function() {
				// 停止下拉刷新
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			// 获取用户信息
			getUserInfo() {
				this.$http.request({
					url: '/organizations/web/user/info'
				}).then(res => {
					res = res.data;
					if (res.result) {
						this.userInfo = res.data;
					} else {
						uni.showToast({
							title: res.data,
							icon: 'none'
						});
					}
				})
			},
			// 退出登录
			exitLogin() {
				var lhamster_identity_info = uni.removeStorageSync("lhamster_identity_info");
				// 跳转到登录页
				uni.redirectTo({
					url: '../user/login'
				});
			}
		}
	}
</script>

<style>
</style>
